feat: add bigint column type support and update dependencies#2950
feat: add bigint column type support and update dependencies#2950ArnabChatterjee20k wants to merge 9 commits intomainfrom
Conversation
Greptile SummaryThis PR adds BigInt column type support to the TablesDB UI — including a new
Confidence Score: 4/5Safe to merge after fixing the One P1 defect:
|
| Filename | Overview |
|---|---|
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/bigint.svelte | New BigInt column form component; min and max are not normalized to bigint before the SDK call (unlike xdefault), which will send JS numbers where the API expects bigints. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/store.ts | Adds buildPayload/castBigIntValue to serialize bigint fields before SDK calls; contains a leftover console.log debug statement on line 65. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/+page.svelte | Type cast for numeric columns updated to include Models.ColumnBigint; BigInt display logic correctly guarded by typeof min === 'bigint' checks. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/store.ts | Registers BigInt column type with correct icon, component, and create/update handlers. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/column.svelte | Adds bigint to column union type and routes bigint rendering through the existing Integer component. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte | Adds bigint case to parseValue and placeholder helpers, falling through to the existing integer branch. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/create.svelte | Integrates buildPayload into prepareRowPayload so bigint fields are serialized correctly on row creation. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte | Uses buildPayload before the updateRow SDK call to ensure bigint fields are correctly typed. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/editRelated.svelte | Both updateRow call sites updated to use buildPayload for related rows. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte | Applies buildPayload to spreadsheet inline edits and maps bigint columns to the hashtag icon. |
| src/lib/helpers/faker.ts | Adds a bigint case using faker.number.bigInt().toString() for test data generation. |
| src/lib/helpers/types.ts | Adds 'bigint' to the columnTypes constant array. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte | Uses buildPayload for bulk row update and create paths in the layout. |
| src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/store.ts | Adds Models.ColumnBigint to the Columns union type. |
Reviews (5): Last reviewed commit: "updated" | Re-trigger Greptile
| case 'bigint': | ||
| case 'integer': { | ||
| const int = parseInt(trimmed, 10); | ||
| return isNaN(int) ? null : int; |
There was a problem hiding this comment.
parseInt silently loses precision for large BigInt values
When column.type === 'bigint', this code falls through to parseInt(trimmed, 10), which returns a JavaScript number. JavaScript number is a 64-bit float with only 53 bits of mantissa, meaning any integer beyond Number.MAX_SAFE_INTEGER (~9×10¹⁵) is silently corrupted.
For example:
parseInt("9007199254740993", 10) // → 9007199254740992 (wrong, off by 1)
BigInt columns in most databases support 64-bit integers (up to ~9.2×10¹⁸), so real values in the upper range of a bigint column will be silently truncated/rounded when saved through this path.
The correct approach is to use BigInt() for the bigint case:
case 'bigint': {
try {
return BigInt(trimmed);
} catch {
return null;
}
}
case 'integer': {
const int = parseInt(trimmed, 10);
return isNaN(int) ? null : int;
}Note that adopting BigInt also requires updating the parseValue return type (number | bigint | boolean | string | null) and ensuring the JSON.stringify comparison in the reactive $effect blocks handles BigInt (since JSON.stringify(BigInt(1)) throws a TypeError).
There was a problem hiding this comment.
Big int is just a split off from the Integer. Earlier integer only handled bigint with this, now a separate type
...project-[region]-[project]/databases/database-[database]/table-[table]/columns/bigint.svelte
Outdated
Show resolved
Hide resolved
.../project-[region]-[project]/databases/database-[database]/table-[table]/columns/+page.svelte
Outdated
Show resolved
Hide resolved
...project-[region]-[project]/databases/database-[database]/table-[table]/columns/bigint.svelte
Show resolved
Hide resolved
- Updated bigint column type handling in the database table columns. - Refactored input components to use InputText for bigint values with validation. - Improved parsing and error handling for bigint inputs in string representation. - Adjusted type definitions to include bigint in various contexts.
- Added bigint type to the Columns type definition. - Updated bigint input handling in the bigint.svelte component, replacing InputText with InputNumber for better user experience. - Enhanced data binding and validation for bigint values, including min, max, and default settings. - Adjusted column value handling in various components to accommodate bigint type.
|
Tip: Greploop — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
| tableId: page.params.table, | ||
| rowId: row.$id, | ||
| data: row | ||
| data: buildPayload(columns, row as Record<string, unknown>) |
There was a problem hiding this comment.
Why unknown here instead of a typed row?
Do we not know the shape,
Can't we define a type?
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)